<?php require_once(dirname(__FILE__).'/inc/config.inc.php');


if ( $_SESSION['adminlevel']>1  &&   $_SESSION['is_wage']=='0' && $_SESSION['check_wage']=='0'   ){
	echo "你没有权限";
	exit();
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>工资</title>
	<link href="templates/style/admin.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="templates/js/jquery.min.js"></script>
	<script type="text/javascript" src="templates/js/listajax.js"></script>
	<script type="text/javascript" src="templates/js/forms.func.js"></script>
	<script type="text/javascript" src="layer/layer.js"></script>
	<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="ui/css/bootstrap.min.css">
	<link rel="stylesheet" href="ui/css/bootstrap-theme.min.css" >
	<link rel="stylesheet" href="ui/css/daterangepicker.css" />
	<script src="ui/js/bootstrap.min.js" ></script>
	<script src='ui/js/common.js'></script>
	<script src="ui/js/date-time/moment.js?ver=1" type="text/javascript"></script>
	<script src="ui/js/date-time/daterangepicker.zh-CN.js?ver=1" type="text/javascript"></script>
	<script src="ui/js/date-time/daterangepicker.js?ver=1" type="text/javascript"></script>
	<script type="text/javascript">
		$(function(){
	// GetFeeList(par_tbn, manageid,is_active,beginTime,endTime,page)
	//GetWageList(par_tbn,manageid,beginTime,endTime,page)
	GetWageList('wage','<?php echo ($manageid = isset($manageid) ? $manageid : ''); ?>','<?php echo ($beginTime = isset($beginTime) ? $beginTime : ''); ?>','<?php echo ($endTime = isset($endTime) ? $endTime : ''); ?>','','');
})
		function updateWage(id){
	//iframe窗
	layer.open({
	  skin: 'layui-layer-molv', //样式类名
	  type: 2,
	  title: '修改工资单',
	  shadeClose: true,
	  shade: false,
      maxmin: true, //开启最大化最小化按钮
      area: ['950px', '600px'],
     content: ['wage_update.php?id='+id], //iframe的url，no代表不显示滚动条
     
 });
}


function add_order(){
	//iframe窗
	layer.open({
	  skin: 'layui-layer-molv', //样式类名
	  type: 2,
	  title: '工资信息',
	  shadeClose: true,
	  shade: false,
      maxmin: true, //开启最大化最小化按钮
      area: ['950px', '600px'],
     content: ['wage_user_list.php'], //iframe的url，no代表不显示滚动条
     
 });
}	


function show_wage(id){
	//iframe窗
	layer.open({
	  skin: 'layui-layer-molv', //样式类名
	  type: 2,
	  title: '查看工资单',
	  shadeClose: true,
	  shade: false,
      maxmin: true, //开启最大化最小化按钮
      area: ['950px', '600px'],
     content: ['wage_show.php?id='+id], //iframe的url，no代表不显示滚动条
     
 });
}	


function delWage(id){

	var id_name=$("#m_"+id).data("index");
	var del_str="您确定要删除    "+id_name+" 该月工资表  吗, 确认删除?";
	layer.confirm(del_str, function() {
		   //操作 
		   $.ajax({
		   	type: 'POST',
		   	url: "wage_save.php",
		   	data: {id:id,action:'delM'},
		   	dataType: 'JSON',
		   	success:function(result){
		   		console.log(result);
		   		if(result.errno==0){
		   			console.log(result.errmsg);
		   			if(result.errmsg==="ok"){
		   				layer.msg('删除成功');
		   				window.location.reload();
		   			}else{
		   				layer.msg(result.err_msg);
		   			}
		   		}
		   	}
		   });
		}, function() {
          //取消操作
      });

}


function CheckWage(par_id,state)
{
	
	$.ajax({
		type: 'POST',
		url: "wage_save.php",
		data: {id:par_id,checkinfo:encodeURI(state),action:'check'},
		dataType: 'JSON',
		success:function(result){
			console.log(result);
			if(result.errno==0){
				console.log(result.errmsg);
				if(result.errmsg==="ok"){
					layer.msg('审核成功');
					window.location.reload();
				}else{
					layer.msg(result.err_msg);
				}
			}
		}
	});

}


</script>
</head>
<body>
	<div class="topToolbar"> <span class="title">工资列表</span>

		<a href="javascript:;" onclick="gethelp()" class="reload btn btn-success">帮助</a>
		<a href="javascript:location.reload();" class="reload btn btn-success">刷新</a></div>

		<div class="alert alert-success" id="help" style="display:none;">
			<button type="button" class="close" data-dismiss="alert">&times;</button>
			<h4>帮助提示!</h4>
			1、点击“全部工资”按钮，可以显示系统内所有的工资信息<br />
			2、点击员工姓名，时间，，可以实时显示所有符合条件的工资信息。<br />
			3、创建工资，默认拉取上个月工资信息；如果新员工，初始值为空<br>
			4、工龄工资，系统自动计算，不支持手动修改
		</div>

		<form name="form" id="form" method="post">
			<div id="list">
				<div class="loading">奖励列表加载中...</div>
			</div>
		</form>
	</body>
	</html>